The Wait Flag

MCI commands usually return to the user immediately, even if it takes several minutes to complete the action initiated by the command. You can use the  wait  (MCI_WAIT) flag to direct the device to wait until the requested action is completed before returning control to the application.

For example, the following playUDIOAK command will not return control to the application until the playback completes:

mciSendString("play mydevice from 0 to 100 wait",
    lpszReturnString, lstrlen(lpszReturnString), NULL);
 

 

Note  The user can cancel a wait operation by pressing a break key. By default, this key is CTRL+BREAK. Applications can redefine this key by using the break4AG387 (MCI_BREAKLIULU3) command. (MCI_BREAK uses the MCI_BREAK_PARMS1I8D9E structure.) When a wait operation is canceled, MCI attempts to return control to the application without interrupting the command associated with the  wait  flag.